package com.example.tests;

import static org.junit.Assert.assertThat;
import static org.hamcrest.Matchers.*;

import java.util.Random;

import org.testng.annotations.Test;

import com.example.utils.SortedListOf;

public class GroupRemovalTests extends TestBase {
	
	@Test
	public void deleteSomeGroup() {
		SortedListOf<GroupData> oldList = app.getModel().getGroups();
	    Random rnd = new Random();
	    int index = rnd.nextInt(oldList.size()-1);
		app.getGroupHelper().deleteGroup(index);
		if (wantToCheck()) {
	    	if ("yes".equals(app.getProperty("check.db"))) {
	    		assertThat(app.getModel().getGroups(), equalTo(app.getHebirnateHelper().listGroups()));
	    	}
	    	if ("yes".equals(app.getProperty("check.ui"))) {
	    		assertThat(app.getModel().getGroups(), equalTo(app.getGroupHelper().getUiGroups()));
	    	}
	    }
	}

}
